/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cassys.delegates;
import cassys.dataaccess.DAOException;
import cassys.datatransferobjects.LecturerDTO;
import cassys.servicelocator.ServiceLocator;
import java.rmi.RemoteException;
import java.util.ArrayList;
import cassys.datatransferobjects.UserDTO;
import cassys.ejb.sessionbean.LecturerBeanRemote;
import cassys.ejb.sessionbean.UserBeanRemote;

public class LecturerDelegate {
        private LecturerBeanRemote lecturerBean  = null;
     
    public LecturerDelegate() {
        lecturerBean = ServiceLocator.getInstance().lookupLecturerBean();
    }
    
    public ArrayList <LecturerDTO> findAllLecturers() throws DAOException, RemoteException {
        ArrayList <LecturerDTO> list = (ArrayList <LecturerDTO>) lecturerBean.findAllLecturers();
        return list;
    }
    
    public LecturerDTO findLecturer(String userId) throws DAOException, RemoteException {
        return lecturerBean.findLecturer(userId);
    }
    
    public LecturerDTO findLecturerByName(String name) throws DAOException, RemoteException {
        return lecturerBean.findLecturerByName(name);
    }   
    
    public void updateLecturer(LecturerDTO lecturer) throws DAOException, RemoteException {
        lecturerBean.updateLecturer(lecturer);
    }
    
    public void insertLecturer(LecturerDTO lecturer) throws DAOException, RemoteException {
        lecturerBean.insertLecturer(lecturer);
    }
    
    public void deleteLecturer(LecturerDTO lecturer) throws DAOException, RemoteException {
        lecturerBean.deleteLecturer(lecturer);
    }
    
    public boolean lecturerValidate(String userid, String password) throws DAOException, RemoteException {
         return (lecturerBean.lecturerValidate(userid.trim(), password.trim()));
    }
    
   
   
 
}
